
const App = getApp();
const navigationBarHeight = (getApp().diygwstatusBarHeight + 44) + 'px'
Page({
    data: {

        msgs1:[],
        buttons2:[
            {type:'submit',url:App.renderUrl('empty','index'),title:``}
        ],
        sc:0,
        id:0,
        url:App.Config.basePath
    },

    showModal(message) {
        App.WxService.showModal({
            title: '友情提示',
            content: message,
            showCancel: !1,
        });
    },
    onShareAppMessage: function () {
    },
    onLoad(option) {
        if (option){
            this.setData({
                globalOption: option,
                id:option.id
            })
        }
    },
    onShow(){
        this.getForm1();
        this.getMsgs1();
    },
    navigateTo(e) {
        App.navigateTo(e.currentTarget.dataset.url, e.currentTarget.dataset);
    },
    getForm1(){
        this.WxValidate = App.WxValidate({
            pjnr: {
                required:{
                    message:'评语：不能为空哟'
                }
            }
        })
    },
    formSubmit1: function (e) {
        if (!this.WxValidate.checkForm(e)) {
            const error = this.WxValidate.errorList[0]
            var msg = `${error.msg}`;
            this.showModal(msg);
            return false
        }else{

            if(this.data.sc==0)
            {
                this.showModal('请选择评分');
                return;
            }
            else
            {
                var data = e.detail.value;
                data =App.Tools.extend(data,{
                    f:1,
                    id:this.data.id,
                    sc:this.data.sc
                });
                App.HttpService.saveData(data,"/ordermore_Edit").then(data => {
                    App.WxService.showToast({
                        title: "评价成功!",
                        icon: 'success',
                        duration: 1500,
                    });
                    setTimeout(function () {
                        wx.navigateBack();
                    }, 1500)
                });
            }


        }
    },
    formReset1: function() {
        console.log('form发生了reset事件')
    },
    select(e){
        this.setData({
            sc:e.currentTarget.dataset.id
        })
    },

    getMsgs1(isShow){
        //调用数据
        let param = {
            f:1,
            id:this.data.id,
            loadmsg:`正在加载中`
        };


        App.HttpService.getData(param,"/ordermore_List").then(data=>{
            this.setData({
                msgs1: data
            });
        });
    },


})
